home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / COMMS / TICKER.ZIP / 023e / SA / SAsource (.txt) < prev   
RISC OS BBC BASIC V Source  |  1998-09-27  |  21KB  |  941 lines

  1.  connect status :
  2.  0 = not connected
  3.  1 = trying
  4.  2 = *** reserved ***
  5.  +-2.5 waiting for confirmation of connect
  6.  3 = connected
  7.  +- 3.5 = download initiated
  8.  4 = downloaded
  9.  5 = ticking (on/off)
  10.  y% 8
  11.  y%!0=&4AF80:y%!4=&400C1
  12.  "Wimp_Initialise",310,&4B534154,"Ticker",y% 
  13.  ,task%
  14. close:
  15. $+" code "+
  16.  "Hourglass_Smash":
  17.  "OS_ReadMonotonicTime" 
  18.  time%
  19.  saold=time%
  20.  "Wimp_ReadSysInfo",7 
  21.  wimp
  22.  wimp>=350 
  23.  wimp=
  24.  wimp=
  25.  connectstatus=1
  26.  mtresolv 
  27.  FIRSTGO 
  28. open_resolver_window
  29.  dragging 
  30.  inwindow 
  31. colourchange
  32.  connectstatus>=4 
  33.  headlineget 
  34. init_sockets:connectstatus=1
  35.  connectstatus 
  36. 9     
  37.  (toggle 
  38.  dragging 
  39.  mouseandin) 
  40.      
  41. firstone
  42.      
  43.  3.5:
  44. threepointfive
  45.      
  46. httpget
  47.      
  48.  2.5:
  49. connect
  50.      
  51. resolve
  52.  updateonoff 
  53. maybeupdate2
  54.  quit%
  55. close
  56. maybeupdate2
  57.  "OS_ReadMonotonicTime" 
  58.  newtime%
  59.  (newtime%-time% > update*6000) 
  60.  time%=newtime%
  61.  (toggle 
  62.  sleep) 
  63. ticker_update
  64. httpget
  65.  ptr%,flags%, request$, file$
  66.  headlineget 
  67.  file$="headline" 
  68.  file$="story2"
  69. 78   request$="GET /tickerdata/"+file$+".dat HTTP/1.0"
  70. 8[   
  71.  proxyonoff 
  72.  request$="GET http://www.bbc.co.uk/tickerdata/"+file$+".dat HTTP/1.0"
  73.  "XSocket_Write",socket%!0,request$+
  74. 10+"User-Agent: BBC Ticker (RiscOS)"+
  75. (request$)+37 
  76. ptr%;flags%
  77.  (ptr%=0 
  78.  (flags% 
  79. 1)=1) 
  80.  !ptr% <> 36 
  81. ;U            connecterror=
  82. :error$="Failed to connect to server":connectstatus=4:
  83. connectstatus=3.5
  84.  at 0 in output file
  85. ("<ticker$dir>."+file$)
  86. output=
  87. output_pos=0
  88. length=0
  89. D"    a=
  90. ("<ticker$dir>."+file$)
  91. resolve
  92.  status,ptr%,flags%
  93. host$="www.bbc.co.uk"
  94.  proxyonoff 
  95.  host$=$(proxyhost%)
  96.  mtresolv 
  97.  &66000,0,host$ 
  98. ,ptr%,flags%
  99.  ptr%=0 
  100.  (flags% 
  101.  1)=1 
  102.  connecterror=
  103. :error$="Resolving address failed":connectstatus=4:
  104. socket_close:
  105. O& ip%=!!(ptr%!16):connectstatus=2.5
  106.  &46001,host$ 
  107.  status,ptr%;flags%
  108.  (flags% 
  109.  (status <> 36) 
  110.      
  111.  ptr%=0 
  112.  (flags% 
  113.  1)=1 
  114.  connecterror=
  115. :error$="Resolving address failed":connectstatus=4:
  116. socket_close:b%!0=resolver%:
  117.  "Wimp_CloseWindow",,b%:
  118. T/   b%!0=resolver%:
  119.  "Wimp_CloseWindow",,b%
  120. U(   ip%=!!(ptr%!16):connectstatus=2.5
  121. connect
  122.  ptr%,flags%
  123. host$="www.bbc.co.uk"
  124. port=80 
  125.  &FFFF
  126.  proxyonoff 
  127.    host$=$(proxyhost%)
  128. `$   port=
  129. ($(proxyport%)) 
  130.  &FFFF
  131.  right lets try to connect
  132. cJb%!0=2 
  133.  ((port 
  134. 256)<<16) 
  135.  ((port 
  136. 256)<<24):b%!4=ip%:b%!8=0:b%!12=0
  137.  "XSocket_Connect",socket%!0,b%,16 
  138.  ptr%;flags%
  139.  (flags% 
  140.  1)=1 
  141.  !ptr% 
  142. g.     
  143.  36:connectstatus=2.5:connecterror=
  144. h.     
  145.  37:connectstatus=2.5:connecterror=
  146. i)     
  147.  56:connectstatus=3:
  148.  beep 
  149.      
  150. kB        connecterror=
  151. :error$=
  152. string0(ptr%+4):connectstatus=4
  153.         
  154. socket_close
  155. mD        
  156.  error$="Invalid argument" 
  157.  error$="Connection failed"
  158. socket_close
  159.  "Socket_Close",socket%!0
  160. addnewicon
  161. wE                   
  162.  (clickerror 
  163.  connecterror) 
  164. readfile
  165.                    
  166.  clickerror 
  167.  connecterror 
  168.  a$="  
  169.   "+error$+".  See help file for troubleshooting.":clickerror=
  170. :clickable(i+1)=
  171. y0                   
  172. updateicon((i+1)
  173. 7,a$,0)
  174. z,                   current=(current+1)
  175.  "OS_ReadMonotonicTime" 
  176.  sa-saold>3 
  177.       saold=sa
  178.       
  179.  i=0 
  180.          b%!0=main%:b%!4=i
  181. '         
  182.  "Wimp_GetIconState",,b%
  183.          
  184.  b%!16>132 
  185. +            x=b%!8-speed:xx=b%!16-speed
  186.             
  187.  x<132 
  188.  x=132
  189.              
  190.  xx<132 
  191.  x=132
  192. >             
  193.    SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
  194. +               
  195.  "Wimp_DeleteIcon",,b%
  196. .                b%!4=main%:b%!8=x:b%!16=xx
  197. -               
  198.  "Wimp_CreateIcon",,b%+4
  199. >                
  200.  i=current 
  201.  xx<windowwidth 
  202. addnewicon
  203.          
  204.       
  205.  "Wimp_BlockCopy",main%,132+speed,-49,windowwidth+speed,-3,132,-49
  206. threepointfive
  207.  mustget
  208. =    
  209.  "XSocket_Read",socket%!0,buffer%,2048 
  210.  len;flags%
  211. #    
  212.  len 
  213.  ((flags% 
  214. 1)=1) 
  215.  stuff in buffer
  216.      d=0
  217.        
  218.         a$=""
  219.          
  220.           a$+=
  221.  buffer%?d
  222.           d+=1
  223. >         
  224.  buffer%?(d-1) = 10 
  225.  buffer%?(d-1) = 13 
  226.  d=len
  227. +        
  228. a$,9)="BBCONLINE" 
  229.  output=
  230.          
  231. a$,7)="REFRESH" 
  232.                 b=
  233.                 a$=
  234. a$,b-1)
  235. 2                
  236.  $(headline%(8))<> 
  237. a$,b-9) 
  238.                 mustget=
  239. ,                $(headline%(8))=
  240. a$,b-9)
  241.                  
  242. save_config
  243.                 
  244.                 a$+=
  245.         
  246. )        
  247. a$,15)="Content-Length:" 
  248.                 b=
  249.                 a$=
  250. a$,b-1)
  251. '                length=
  252. a$,b-16))
  253.         
  254.             
  255.  output 
  256.                
  257. #a=output_pos
  258.               
  259. #a,a$;
  260.                output_pos=
  261. 4                  
  262.  length=output_pos 
  263.  length 
  264.                      
  265. V                      
  266.  headlineget 
  267.  length <1000 
  268.  headlineget=
  269. load_headlines
  270. )                      connectstatus=4
  271. :                      
  272.  "Socket_Shutdown",socket%!0,2
  273. 5                      
  274.  "Socket_Close",socket%!0
  275. 8                      
  276.  FIRSTGO 
  277.  connectstatus+=1
  278. ,                      
  279.  toggle 
  280. toggle
  281.                   
  282.             
  283.        
  284.  d=len
  285.         
  286.  mustget 
  287.  headlineget=
  288. firstone
  289.  get first icon data
  290.  connecterror 
  291. readfile 
  292.  a$="  "
  293.  plot that first one
  294. getmodeinfo
  295. updateicon(0,a$,windowwidth-154)
  296.  connectstatus=5
  297.  FIRSTGO=
  298. readfile
  299.  x1$, x2$
  300. ("<ticker$dir>.story2")
  301. extent=
  302. #y1=position
  303.   x1$=
  304.   x1=
  305.  x1=extent 
  306.  position=0 
  307.  position=x1
  308. x1$,5)="STORY" 
  309.  channel(
  310. x1$,1)))
  311.  x1=extent 
  312. #y1=0
  313.   x1$=
  314.  x1>11
  315. x1$="  
  316. x1$,x1-9)
  317.   x1=
  318.  x1=extent 
  319.  position=0 
  320.  position=x1
  321.   x2$=
  322.  x2$ <10 
  323.  clickable((i+1)
  324.  clickable((i+1)
  325. updateicon(number,text$,add)
  326.  before,bwidth
  327.  ** calculate width of icon **
  328.  wimp 
  329.  "Wimp_TextOp",1,text$,0 
  330.  width 
  331.  width=
  332.  text$*16
  333.  ** where is the icon before?
  334. before=(number+6)
  335. b%!0=main%:b%!4=before
  336.  "Wimp_GetIconState",,b%
  337. bwidth=b%!16
  338. b%!0=main%:b%!4=number
  339.  "Wimp_GetIconState",,b%
  340.  "Wimp_DeleteIcon",,b%
  341. 7  b%!4=main%:b%!8=bwidth+add:b%!16=bwidth+width+add
  342.  "Wimp_CreateIcon",,b%+4
  343.   SYS "Wimp_ResizeIcon",main%,number,bwidth+add,-49,bwidth+width+add,-3
  344. $(message%(number))=a$
  345. )b%!0=main%:b%!4=number:b%!8=0:b%!12=0
  346.  "Wimp_SetIconState",,b%
  347. close
  348.  "Wimp_CloseDown",task%,&4B534154
  349. "unset ticker$running"
  350. "unset ticker$Update"
  351.  "OS_ReadMonotonicTime" 
  352.  "Wimp_PollIdle",2,b%,t%+poll 
  353. windowopen
  354.  "Wimp_CloseWindow",,b%
  355.  b%!0=main% 
  356.  inwindow=
  357. :mouseandin=
  358. makeblack(blue):blue=7
  359.  b%!0=main% 
  360.  inwindow=
  361.  mouseover 
  362.  mouseandin=
  363.  mouseandin=
  364. mouseclick
  365. processkey(b%!0,b%!4,b%!24)
  366. menuclick
  367.  17,18,19:
  368. receive(r%,b%)
  369. depressed 
  370.  dragging=
  371. userdrag
  372. depressed
  373.  data
  374.  "Wimp_GetPointerInfo",,b%
  375. data=b%!8
  376.  data/2 <> 
  377. (data/2) 
  378.  data=
  379.  data=
  380.     =data
  381. userdrag
  382. b%!0=main%
  383.  "Wimp_GetWindowState",,b%
  384. windowwidth=b%!12-b%!4
  385. processkey(win,ico,key)
  386.  "Wimp_ProcessKey",key
  387. windowopen
  388.  !b%=main% 
  389.  modechanging 
  390. getmodeinfo 
  391.  "Wimp_OpenWindow",,b%
  392. receive(u,t%)
  393.  t%!16 
  394.  0:quit%=
  395.  &400C1
  396.      modechanging=
  397.  &4AF80
  398.      
  399.  u<>19 
  400. 2.     
  401.  now try and load prog to launch url
  402. 3>     
  403.  "XOS_ReadVarVal","Alias$URLOpen_HTTP",b%,256 
  404.       
  405.  u = 0 
  406.              clickerror=
  407. 6O             error$="No Application has been seen that can launch this URL"
  408.       
  409. 8.             $b%="URLOpen_HTTP "+launched$
  410. 9'             
  411.  "Wimp_StartTask",b%
  412.       
  413. mouseandin=
  414. poll=0
  415. dragging=
  416. headlineget=
  417. toggle=
  418.  clickable(7)
  419. inwindow=
  420. blue=7
  421. modechanging=
  422. FIRSTGO=
  423. output=
  424.  socket% &10
  425.  headline%(8)
  426.  buffer% 2048
  427. connectstatus=0
  428. clickerror=
  429. connecterror=
  430. position=0
  431. current=0
  432.  b% 2048, menspc% 512, ws% 3072
  433.  message%(6)
  434.  channel(8)
  435. wsend%=ws%+3072
  436. quit%=
  437. connected=
  438. load_templates
  439. load_config
  440. ticker_menu
  441. attach(tickermenu%,0,infobox%)
  442. test_resolver
  443. init_sockets
  444. getmodeinfo
  445. test_resolver
  446.  ptr%,flags%
  447.  "XOS_Module",18,"Resolver" 
  448.  ,,,ptr%;flags%
  449.  (flags% 
  450.  mtresolv=
  451.  mtresolv=
  452. getmodeinfo
  453.  height%
  454. modechanging=
  455.  "OS_ReadModeVariable",-1,11 
  456.  ,,modewidth
  457.  "OS_ReadModeVariable",-1,12 
  458.  ,,modeheight
  459. modewidth+=1:modeheight+=1
  460.  connectstatus 
  461. !b%=main%
  462. o, b%!0=main%:
  463.  "Wimp_GetWindowState",,b%
  464. p2 b%!4=leftwindow:b%!16=topwindow:b%!8=b%!16-52
  465.  b%!12=b%!4+windowwidth
  466.  b%!12>modewidth*2 
  467.  b%!12=modewidth*2:windowwidth=b%!12-b%!4
  468.  toggle 
  469.  b%!12=b%!4+132
  470.  autoadjust 
  471.     windowwidth=modewidth*2
  472. v-    
  473.  windowwidth>3500 
  474.  windowwidth=3500
  475. w+    
  476.  windowwidth<500 
  477.  windowwidth=500
  478.     height=modeheight*2
  479.  iconbar 
  480.  height=188
  481. z<    b%!4=0:b%!8=height-52:b%!12=windowwidth:b%!16=height
  482.  toggle 
  483.  b%!12=132
  484.  "Wimp_OpenWindow",,b%
  485. toggle
  486.  toggle 
  487.     toggle=
  488.     poll=0
  489.    toggle=
  490.    poll=500
  491.    !b%=main%
  492.  "Wimp_GetWindowState",,b%
  493.  toggle 
  494.    b%!12=b%!4+132
  495.    b%!12=b%!4+windowwidth
  496.  "Wimp_OpenWindow",,b%
  497. init_sockets
  498.  create a new socket for use, internet, stream
  499.  "Socket_Creat",2,1,0 
  500.  socket%!0
  501. !b%=-1
  502.  "Socket_Ioctl",socket%!0,&8004667E,b%
  503. load_config
  504.  a, b, r$
  505. ("<ticker$dir>.choices")
  506.    r$=
  507.    speed=
  508. (r$)*2
  509.    tempspeed=speed
  510.    $(speed%)=
  511. (speed*2)
  512.    updateonoff=
  513.    sleep=
  514.  updateonoff 
  515. iconstate(config%,7,1)
  516.  sleep 
  517. iconstate(config%,32,1)   
  518.    r$=
  519.    update=
  520.    tempupdate=update
  521. -   $(update%)="Every "+
  522. (update)+" mins."
  523.  b=1 
  524.    r$=
  525.     channel(b)=
  526. 1    
  527.  channel(b) 
  528. iconstate(config%,b+11,1)
  529.    windowwidth=
  530.  windowwidth<500 
  531.  windowwidth=500
  532.  windowwidth>3500 
  533.  windowwidth=3500
  534.    $(proxyhost%)=
  535.    temphost$=$(proxyhost%)
  536.    $(proxyport%)=
  537.     tempport=
  538. ($(proxyport%))
  539.    r$=
  540.    proxyonoff=
  541.  proxyonoff 
  542. iconstate(config%,23,1)
  543.    $(headline%(8))=
  544.    autoadjust=
  545.  autoadjust 
  546. iconstate(config%,28,1)
  547.    iconbar=
  548.    leftwindow=
  549.    topwindow=
  550.    beep=
  551.  beep 
  552. iconstate(config%,30,1)
  553.    lowgraphics=
  554.  lowgraphics 
  555. iconstate(config%,29,1)
  556.    colour=
  557.  colour<0 
  558.  colour>15 
  559.  colour=15
  560.    mouseover=
  561.  mouseover 
  562. iconstate(config%,33,1)           
  563. load_headlines
  564. load_headlines
  565.  a,b,r$
  566. ("<ticker$dir>.headline")
  567.       r$=
  568.  b=0 
  569.      $(headline%(b))=
  570. save_config
  571.  a, b, i
  572. ("<ticker$dir>.choices")
  573. (tempspeed/2)
  574. "    b=
  575. geticonstate(config%,7)
  576. #    b=
  577. geticonstate(config%,32)
  578. (b)       
  579. (tempupdate)
  580.  i=1 
  581. &    b+=
  582. geticonstate(config%,11+i)
  583.  i=1 
  584. 4    
  585.  channel(i)=
  586. geticonstate(config%,11+i)
  587. (channel(i))
  588. (windowwidth)
  589. #a,$(proxyhost%)
  590. #a,$(proxyport%)
  591. #    b=
  592. geticonstate(config%,23)
  593. #a,$(headline%(8))
  594. #    b=
  595. geticonstate(config%,28)
  596. (iconbar)
  597.    !b%=main%
  598.  "Wimp_GetWindowState",,b%
  599. (b%!4)
  600. (b%!16)
  601. "   b=
  602. geticonstate(config%,30)
  603. "   b=
  604. geticonstate(config%,29)
  605.  colour
  606. "   b=
  607. geticonstate(config%,33)
  608. load_config
  609. load_templates
  610.  "Wimp_OpenTemplate",,"<ticker$Dir>.Templates"
  611.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"main", 0 
  612.  ,,ws%
  613. message%(0)=b%!(108+(32*0))
  614. message%(1)=b%!(108+(32*1))
  615. message%(2)=b%!(108+(32*2))
  616. message%(3)=b%!(108+(32*3))
  617. message%(4)=b%!(108+(32*4))
  618. message%(5)=b%!(108+(32*5))
  619. message%(6)=b%!(108+(32*6))
  620.  "Wimp_CreateWindow",,b% 
  621.  main%
  622.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"Info", 0 
  623.  ,,ws%
  624.  "Wimp_CreateWindow",,b% 
  625.  infobox%
  626.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"config", 0 
  627.  ,,ws%
  628. speed%=b%!(108+(32*21))
  629. update%=b%!(108+(32*6))
  630.  i=0 
  631. #headline%(i)=b%!(108+32*(i+12))
  632. proxyhost%=b%!(108+(32*24))
  633. proxyport%=b%!(108+(32*25))
  634.  "Wimp_CreateWindow",,b% 
  635.  config%
  636.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"message", 0 
  637.  ,,ws%
  638.  "Wimp_CreateWindow",,b% 
  639.  resolver%
  640.  "Wimp_CloseTemplate"
  641.  ** resize icons **
  642.  i=0 
  643.  SYS "Wimp_ResizeIcon",main%,i,132,-49,132,-3
  644. >             
  645.    SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
  646. +                      b%!0=main%:b%!4=i
  647. '         
  648.  "Wimp_GetIconState",,b%
  649. +               
  650.  "Wimp_DeleteIcon",,b%
  651.  1                b%!4=main%:b%!8=132:b%!16=132
  652. !-               
  653.  "Wimp_CreateIcon",,b%+4
  654. colourchange
  655.  icon
  656.  "Wimp_GetPointerInfo",,b%
  657. icon=b%!16
  658.  icon>-1 
  659.  icon <8 
  660.  icon<>7 
  661.  icon<>blue 
  662.  clickable(icon) 
  663. makeblue(icon)
  664. ,5   
  665.  blue<>7 
  666.  clickable(blue) 
  667. makeblack(blue)
  668.    blue=icon
  669. makeblue(i)
  670.         b%!0=main%:b%!4=i
  671. 4)           
  672.  "Wimp_GetIconState",,b%
  673. 5#           b%!8=colour*&1000000
  674.            b%!12=&F000000
  675. 7)           
  676.  "Wimp_SetIconState",,b%
  677. makeblack(i)
  678.  i<0 
  679.  i>6 
  680.         b%!0=main%:b%!4=i
  681. =)           
  682.  "Wimp_GetIconState",,b%
  683.            b%!8=&7000000
  684.            b%!12=&F000000
  685. @)           
  686.  "Wimp_SetIconState",,b%
  687. mouseclick
  688.  b%!12 
  689.  main%:
  690.  b%!8 
  691. G.    
  692. showmenu(tickermenu%,!b%-64,b%!4)
  693.  4:i=b%!16:
  694. IZ        
  695.  7:b%!0=main%:b%!4=1:b%!8=10:b%!12=10:b%!16=50:b%!20=50:
  696.  "Wimp_DragBox",,b%
  697.         
  698.         
  699.  i<>7 
  700. L+           a$=
  701. geticontext(main%,b%!16)
  702.            
  703. load_url(a$)
  704.         
  705.  1:i=b%!16:
  706.          
  707. toggle
  708.          
  709.          
  710.  i<>7 
  711.          dragging=
  712. TS         b%!0=main%:b%!4=2:b%!8=0:b%!12=0:b%!16=0:b%!20=0:
  713.  "Wimp_DragBox",,b%
  714.          
  715.  config%:
  716.  b%!16 
  717. X5       
  718.  3:b%!0=config%:
  719.  "Wimp_CloseWindow",,b%
  720. YB       
  721. save_config:b%!0=config%:
  722.  "Wimp_CloseWindow",,b%
  723.        
  724.  tempspeed>2 
  725.  tempspeed-=2:$(speed%)=
  726. (tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
  727.  "Wimp_SetIconState",,b%
  728.        
  729.  tempspeed<20 
  730.  tempspeed+=2:$(speed%)=
  731. (tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
  732.  "Wimp_SetIconState",,b%
  733.        
  734.  tempupdate >1 
  735.  tempupdate-=1:$(update%)="Every "+
  736. (tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
  737.  "Wimp_SetIconState",,b%
  738.        
  739.  tempupdate <60 
  740.  tempupdate+=1:$(update%)="Every "+
  741. (tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
  742.  "Wimp_SetIconState",,b%
  743.        
  744. proxy_shade
  745.        
  746. update_shade
  747. `3       
  748.  27: 
  749. "Filer_OpenDir <ticker$dir>.help"
  750. proxy_shade
  751. geticonstate(config%,23)
  752.  i=24 
  753. iconshade(config%,i,
  754. update_shade
  755. geticonstate(config%,7)
  756. iconshade(config%,6,
  757. iconshade(config%,10,
  758. iconshade(config%,11,
  759. iconshade(config%,32,
  760. load_url(a$)
  761. a$,x2-5)
  762. ("<ticker$dir>.story2")
  763. #y2=0
  764.   x2$=
  765. x2$,8)="HEADLINE" 
  766.      x2=
  767.      x2$=
  768. x2$,x2-9)
  769.  x2=t2 
  770.  x2$=a$
  771.  x2$=a$ 
  772.   x2$=
  773.   t2=
  774.   x2$=
  775. x2$,t2-4)
  776.  x2$<>"" 
  777. launch_url(x2$,1)
  778. ticker_update
  779.  Shit! Time to update the ticker
  780.  we ARE NOT connected, honest
  781.  "OS_ReadMonotonicTime" 
  782.  time%
  783. connectstatus=0
  784. position=0
  785. init_sockets
  786. connectstatus=1
  787.  mtresolv 
  788.  FIRSTGO 
  789. open_resolver_window
  790. open_resolver_window
  791. b%!0=resolver%
  792.  "Wimp_GetWindowState",,b%
  793. %b%!4=modewidth-196:b%!12=b%!4+392
  794. %b%!8=modeheight-96:b%!16=b%!8+192
  795.  "Wimp_OpenWindow",,b%
  796. launch_url(a$,do)
  797.  hi%, len%, temp$
  798. !b%!0=256:b%!12=0:b%!16=&4AF80
  799.  lowgraphics 
  800.  hi%=
  801. a$,"/hi/"):len%=
  802.  temp$=
  803. a$,len%-(len%-hi%)-1)
  804. temp$+="/low/"
  805. temp$+=
  806. a$,len%-hi%-3)
  807. a$=temp$
  808. $(b%+20)=a$+
  809.  "Wimp_SendMessage",18,b%,0,0
  810. launched$=a$
  811. menuclick
  812. c%=b%+900
  813.  "Wimp_GetPointerInfo",,c%
  814. adj%=(c%!8 
  815.  "Wimp_DecodeMenu",,topmenu%,b%,c%
  816.  $c% 
  817.  "Quit":quit%=
  818.  "Update Now":
  819. ticker_update
  820.  "The BBC":
  821. launch_url("http://www.bbc.co.uk/",0)
  822.  "News Online":
  823. launch_url("http://news.bbc.co.uk",0)
  824.  "Updates...":
  825. launch_url("http://www.geocities.com/Paris/Lights/7724",0)
  826.  "Choices":
  827. update_choices
  828.  adj% 
  829. showmenu(topmenu%,topx%,topy%)
  830. update_choices
  831.  c%=1 
  832. iconstate(config%,c%+11,-channel(c%))
  833. $(speed%)=
  834. (speed/2)
  835. *$(update%)="Every "+
  836. (update)+" mins."
  837. $(proxyport%)=
  838. (tempport)
  839. $(proxyhost%)=temphost$
  840. iconstate(config%,23,proxyonoff)
  841. iconstate(config%,28,autoadjust)
  842. iconstate(config%,30,beep)
  843. iconstate(config%,29,lowgraphics)
  844. iconstate(config%,33,mouseover)
  845. proxy_shade
  846. update_shade
  847. E!b%=config%:
  848.  "Wimp_GetWindowState",,b%:
  849.  "Wimp_OpenWindow",,b%
  850.  ---- menu stuff ----
  851. make_menu
  852. start%=menspc%
  853.  title$
  854. $(start%)=title$
  855. start%?12=7
  856. start%?13=2
  857. start%?14=7
  858. start%?15=0
  859. start%!20=44
  860. start%!24=0
  861. width%=
  862. (title$)-3
  863. menspc%+=28
  864.  item$
  865.  item$<>"*" 
  866. !menspc%=0
  867. writeable%=
  868. item$,"_")
  869.  ul% 
  870. tail$=
  871. item$,
  872. (item$)-ul%)
  873. tail$,"T") !menspc%=!menspc% 
  874. tail$,"D") !menspc%=!menspc% 
  875. tail$,"W") !menspc%=!menspc% 
  876.  4:writeable%=
  877.  buffer%:
  878.  buflen%
  879. tail$,"M") !menspc%=!menspc% 
  880. item$=
  881. item$,ul%-1)
  882.  item$>width% width%=
  883.  item$
  884. menspc%!4=-1
  885.  writeable% 
  886. Zmenspc%!8=&0700F121:menspc%!12=buffer%:menspc%!16=-1:menspc%!20=buflen%:$buffer%=item$
  887.  item$<12 
  888. +menspc%!8=&07000021:$(menspc%+12)=item$
  889. Imenspc%!8=&0700F121:menspc%!12=ws%:mwnspc%!16=-1:menspc%!20=
  890.  item$+1
  891. $ws%=item$:ws%+=
  892.  item$+1
  893. menspc%+=24
  894.  item$="*"
  895. start%!16=width%*16+32
  896. %!(menspc%-24)=!(menspc%-24) 
  897. mptr%=menspc%
  898. =start%
  899. attach(menu%,item%,sub%)
  900. !(menu%+28+item%*24+4)=sub%
  901. showmenu(menu%,x%,y%)
  902. $topmenu%=menu%:topx%=x%:topy%=y%
  903.  "Wimp_CreateMenu",,menu%,x%,y%
  904. ticker_menu
  905.  Ticker,Info,Choices,Update Now,Quit_D,The BBC,News Online,Updates...,*
  906. tickermenu%=
  907. make_menu
  908. geticonstate(win%,icon%)
  909. 2!b%=win%:b%!4=icon%:
  910.  "Wimp_GetIconState",,b%
  911. =(b%!24>>21 
  912.  1)>0
  913. iconstate(win%,icon%,type%)
  914.  s%,t%
  915.  type% 
  916.  0:s%=0<<21:t%=1<<21
  917.  -1,1:s%=1<<21:t%=1<<21
  918.  2:s%=1<<21:t%=0<<21
  919. )b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
  920.  "Wimp_SetIconState",,b%
  921. iconshade(win%,icon%,type%)
  922.  s%,t%
  923.  type% 
  924.  0:s%=0<<22:t%=1<<22
  925.  -1,1:s%=1<<22:t%=1<<22
  926.  2:s%=1<<22:t%=0<<22
  927. ()b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
  928.  "Wimp_SetIconState",,b%
  929. geticontext(win%,icon%)
  930. -3b%!0=win%:b%!4=icon%:
  931.  "Wimp_GetIconState",,b%
  932.  ((b%!24) 
  933.  &100)=0 
  934. string0(b%+28)
  935. string0(b%!28)
  936. string0(a%):
  937.  a%=0 
  938. ?a%>31 
  939. (a$)<255:a$=a$+
  940. ?a%:a%=a%+1:
  941.